# Makefile for cygwin gcc
# Wang Wen, Albert <jawangwen@gmail.com>

TARGET         := autotest
OBJECT_PRODUCT := $(patsubst %.c,%.o,$(wildcard product/*.c))
OBJECT_CASES   := $(patsubst %.c,%.o,$(wildcard cases/*.c))
LIB            := library/lib.a
DIR_ROOT       := $(shell pwd)

include rules.mk

CFLAGS += -std=c99 -fprofile-arcs -ftest-coverage

${TARGET}: ${OBJECT_PRODUCT} ${OBJECT_CASES}  ${LIB}
	$(CC) -o $@ $(CFLAGS) $^

${OBJECT_CASES}:
	cd ${DIR_CASES} && ${MAKE}

${OBJECT_PRODUCT}:
	cd ${DIR_PRODUCT} && ${MAKE}

${LIB}:
	cd ${DIR_LIB} && ${MAKE}

.PHONY : clean
clean:
	cd ${DIR_PRODUCT} && ${MAKE} clean
	cd ${DIR_CASES} && ${MAKE} clean
	rm -f autotest.sym_tbl autotest.sym_tmp autotest.exe
	rm -rf report/*

